#动态数组
class DynamicArray(object):
    def __init__(self,maxsize=16,cursize=0):
        self.max_size = maxsize
        self.cur_size = cursize
        self.array = [None] * self.max_size

    def push_back(self, elem):
        if self.cur_size == self.max_size:
            self.max_size *= 2
            newArray = [None] * self.max_size
            for i in range(self.max_size):
                newArray[i] = self.array[i]
            self.array = newArray
        self.array[self.cur_size] = elem
        self.cur_size += 1

    def pop_back(self):
        if self.cur_size == 0:
            return None
        else:
            self.cur_size -= 1
            return self.array[self.cur_size]

    def elem_max(self):
        max_e = self.array[0]
        for i in range(self.size()):
            if self.array[i] > max_e:
                max_e = self.array[i]
        print(max_e)
        return max_e

    def size(self):
        return self.cur_size

    def index(self, i):
        return self.array[i]
